#ifndef GLOBAL_H
#define GLOBAL_H

#define LOCATION_X 45
#define LOCATION_Y 20
#define VERTEX_TRIANGLE LOCATION_Y + 10

#define INITIAL_HEIGHT 30

#include <QObject>
#include<QWidget>
#include<QLabel>
#include<QJsonObject>
#include<QJsonArray>
#include<QJsonDocument>
#include<QJsonValue>
#include<QMessageBox>
#include <QByteArray>
#include<QNetworkAccessManager>
#include<QNetworkReply>
#include<QFileDialog>
#include<QStyle>

extern std::function<void(QWidget*)> repolish;
extern QString GATE_URL;
extern const QString MachineCode;
extern const QString TemporaryAvatar;
extern const QString FileData;
extern const QString FileAvatar;
extern const QString FileOtherFiles;
extern const QString FileChattingRecords;
extern QString AvatarPath;

const QString _getComputerUUID();//获得机器码
void isGetAvatar(const QString& name);



//请求id用来确定这个请求是干什么的
enum class ReqId{
    ID_HEARTBEAT = 9999,
    ID_QUIT_LOGIN = 1000,//退出登录
    ID_GET_VARIFY_CODE = 1001, //获取验证码
    ID_REG_USER = 1002, //注册用户
    ID_GET_OFFLINE_MSG = 1003,//获得离线消息
    ID_LOGIN_USER = 1004, //用户登录
    ID_CHAT_LOGIN = 1005, //登陆聊天服务器
    ID_CREATE_GROUP_CHAT = 1006,//创建群聊
    ID_SEARCH_USER_REQ = 1007, //用户搜索请求
    ID_ADD_FRIEND_REQ = 1009,  //添加好友申请
    ID_UPLOAD_AVATAR = 1008,
    ID_AUTH_FRIEND_REQ = 1013,  //认证好友请求
    ID_CHECK_USER = 1020,//检查用户是否查找
    ID_AUTO_LOGIN_USER = 1021,//自动登录
    ID_Get_AVATAR = 1022,//获得头像
    ID_GET_FRIEND_LIST = 1023,//获得好友列表
    ID_TEXT_CHAT_MSG  = 1017,  //发送文本聊天信息
    ID_TEXT_CHAT_GROUP_MSG = 1010,//发送文本群聊信息
    ID_CHAT_MSG_RSP = 1018,//文本聊天信息回包
    ID_NOTIFY_TEXT_CHAT_MSG_REQ = 1019, //通知用户文本聊天信息
    ID_CHAT_MSG_ACK = 1020,//消息确认
};

enum class Modules{
    REGISTERMOD,
    LOGINMOD,
    GLOBALMOD,
};

enum class ErrorCodes{
    SUCCESS,
    ERR_JSON,
    ERR_NETWORK,
};

enum TipErr{
    TIP_SUCCESS = 0,
    TIP_EMAIL_ERR = 1,
    TIP_PWD_ERR = 2,
    TIP_CONFIRM_ERR = 3,
    TIP_PWD_CONFIRM = 4,
    TIP_VARIFY_ERR = 5,
    TIP_USER_ERR = 6
};

enum class UserType{
    Other_Users,
    Current_User,
};

enum class NewsType : int{
    text = 1,
    picture,
    video,
    rests,
    videoCall
};

struct ServerInfo{
    QString user;
    QString Host;
    QString Port;
    QString Token;
    int Uid;
};



#endif // GLOBAL_H
